
import { useState } from 'react';

export default function usePagination(config = {}) { 
    const { size = 5 } = config 
    const [current, setCurrent] = useState(1);
    const [pageSize, setPageSize] = useState(size);
    return {
        current,
        pageSize,
        position:['bottomCenter'],
        hideOnSinglePage: true,
        showTotal: total => { 
            return <span>共有{total}条数据</span>
        },
        onChange(page, pageSize) { 
            setCurrent(page)
            setPageSize(pageSize)
        }
    }
}